home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 50
/
Volume 50 - JOGO DISK .iso
/
Games
/
moonstonemadness.swf
/
scripts
/
__Packages
/
MoonStoneObstacle.as
< prev
next >
Wrap
Text File
|
2007-09-27
|
2KB
|
56 lines
class MoonStoneObstacle extends SideScroller.StaticObject
{
function MoonStoneObstacle(__mcRef, __oLayer, _nPercent)
{
super(__mcRef,__oLayer);
if(_nPercent == undefined)
{
_nPercent = 100;
}
this.nPercent = _nPercent;
this.bObjectBlock = false;
this.bObjectSpecial = true;
this.setState("Idle");
}
function onHitSpecial(__oRef)
{
if(this.__get__CurrentState() == "Idle")
{
if(TakGround(__oRef).__get__IsInHeadSwing())
{
this.__get__ParentLayer().doAddListener(this);
Library.Sound.SoundManager.doPlaySoundInCat(Main.SOUND_CAT_SOUND,"ItemHit.mp3");
if(Library.Utils.MoreMath.getRandomRange(1,100) < this.nPercent)
{
var _loc3_ = this.__get__ParentLayer().doAttachVisual("Dynamic_MoonStone");
_loc3_._x = this.__get__Coord().x;
_loc3_._y = this.__get__Coord().y;
_global.LevelManager.Instance.doAddMoonStone(_loc3_);
}
this.setState("Explode");
this.doLockState();
}
}
}
function doDestroy()
{
this.__get__ParentLayer().doRemoveListener(this);
super.doDestroy();
}
function doExplode()
{
if(this.isStateComplete())
{
if(!this.mcRef.bStateAfterExplosion)
{
this.doDestroy();
}
else
{
this.doForcedSetState("ExplodedIdle");
this.__get__ParentLayer().doRemoveListener(this);
}
}
}
}